package org.other.leeCode0007;

/**
 * @Author: wjy
 * @Date: 2021/11/30 15:22
 */
public class Solution {

    public static void main(String[] args) {

        Solution solution = new Solution();

        double d = 123.456;
        float i = (float) d;

        System.out.println(i);

        System.out.println(solution.reverse(104));

    }

    public int reverse(int x) {

        long index = 1, temp = 0;

        while(true) {
            if (x / index == 0) {
                break;
            }
            temp = temp * 10 + x / index % 10;
            index *= 10;

        }

        return temp > Integer.MAX_VALUE || temp < Integer.MIN_VALUE ? 0 : (int) temp;
    }

}
